package fcrpt

class WipInventoryController {
    def dynamicQueryService
    def wipInventory() {
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def wipInventorySum=[]
        def tableHeadList=[]
        def wipInventory=[]
        def list=[]
        def pageSizeList = [10,20,50,100]
        def totalCount =0
        params.SYS_QUERY_NAME = 'wipInventorySumQty'
        def wipInventorySumQty = dynamicQueryService.queryForList(params)
        if(params.EXPORT_CONTENT_NAME=='Excel'){
            params.SYS_QUERY_NAME = 'wipInventory'
            wipInventory = dynamicQueryService.queryForList(params)
            if (wipInventory.size() > 0) {
                tableHeadList = wipInventory[0].keySet()
            }
            params.SYS_QUERY_NAME = 'wipInventoryCount'
            totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
            //list=TranposUtils.colToRow('STEP_NAME','STEP_QTY',partFinList)

//            params.SYS_QUERY_NAME = 'orderStatusAnalysisSum'
//            orderStatusAnalysisSum = dynamicQueryService.queryForList(params)

        }
        [pageSize     : pageSize, totalCount: totalCount, pageSizeList: pageSizeList,pageCurrent:pageCurrent,
         wipInventorySum:wipInventorySum,tableHeadList:tableHeadList,wipInventory:wipInventory,startno:params.startno?:'',endno:params.endno?:'',materialName:params.materialName?:'',
         startTime:params.startTime,endTime:params.endTime,partName:params.partName,stepName:params.stepName,
         totalGroup:params.totalGroup,detailCate:params.detailCate,partDirection:params.partDirection,group3:params.group3,wipInventorySumQty:wipInventorySumQty]
    }
}
